<% content_for :sub_navbar do %>
<div class="sub-navbar team-header">
  <div class="container">
    <div class="media">
      <div class="media-left">
        <%= user_avatar_tag(@team, :md, link: false) %>
      </div>

      <% if current_user && !@team.has_member?(current_user) && !admin?%>
        <div class="media-left">
          <% if @team.pendding_status?(current_user)%>
              <%= link_to '接受邀请', main_app.user_team_user_path(@team, @team.get_team_user(current_user)), class: 'btn btn-link request-join' %>
          <% else %>
              <%= link_to '申请加入', main_app.requestjoin_team_path(@team), class: 'btn btn-link request-join',remote: true %>
          <% end %>
        </div>
      <% end %>

      <div class="media-body">
        <h1 class="media-heading">
          <%= @team.name %>
          <% if @team.location.present? %>
            <span class="location"><i class="fa fa-map-marker"></i> <%= @team.location %></span>
          <% end %>
        </h1>
      </div>
      <div class="media-right">
        <span class="icons">
          <% if !@team.website.blank? %>
            <%= link_to(raw('<i class="fa fa-globe"></i>'), @team.website_url, target: '_blank', rel: 'nofollow') %>
          <% end %>

          <% if !@team.github.blank? %>
            <%= link_to(raw('<i class="fab fa-github"></i>'), @team.github_url, target: '_blank', rel: 'nofollow') %>
          <% end %>

          <% if !@team.twitter.blank? %>
            <%= link_to raw('<i class="fab fa-twitter"></i>'), @team.twitter_url, class: "twitter", rel: "nofollow" %>
          <% end %>

          <% if !@team.email.blank? && @team.email_public %>
            <a href="mailto: <%= @team.email %>"><i class="fa fa-envelope-o"></i></a>
          <% end %>
        </span>
      </div>
    </div>
  </div>
</div>
<% end %>

<%= render_list class: "nav nav-tabs team-menu" do |li|
  li << link_to(t("teams.topics"), user_path(@team), class: "nav-link")
  li << link_to(t("teams.users"), user_team_users_path(@team), class: "nav-link")
  li << link_to(t("teams.settings"), edit_team_path(@team), class: "nav-link") if can?(:update, @team)
end %>
